import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
import Store from '@/store'
Vue.use(VueRouter)

const router = new VueRouter({
  routes
})
// 导航前置守卫 全局的
router.beforeEach((to, from, next) => {
  // console.log(to)
  next()
  const { title, isBackShow } = to.meta
  Store.commit('isBackShowAndChangeTitle', { title, isBackShow })
})
export default router
